package com.changgou.goods.config;

import com.changgou.util.IdWorker;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName IdWorkerConfig
 * @Auther: Jiang YiLin
 * @Date: 2019/11/17  21:36
 * @Description:
 */
@Configuration
public class IdWorkerConfig {

    @Value("${workerId:0}")
    private Integer workerId;
    @Value("${datacenterId:0}")
    private Integer datacenterId;

    @Bean
    public IdWorker idWorker(){
        return new IdWorker(workerId,datacenterId);
    }
}
